#include <WinTen.h>
#include <Windows.h>
#include <extend.h>

//----------------------------------------------------------------------------//

CLIPPER GETWINDOWT()
{
   HWND hWnd   = ( HWND ) _parnl( 1 );
   int iLen    = IF( IsWindow( hWnd ), GetWindowTextLength( hWnd ), 0 );
   POVM pMem;
   LPSTR pText;

   if( iLen > 0 )
   {
      pMem = _vmAlloc( iLen + 1 );
      GetWindowText( hWnd, pText = _vmLock( pMem ), iLen + 1 );
      _retclen( pText, iLen );
      _vmFree( pMem );
   }
   else
      _retc( "" );
}

//----------------------------------------------------------------------------//

CLIPPER MGETLINE() // ( hMultiGet, nLine ) --> cLine
{
   BYTE Buffer[ 255 ];

   _retclen( Buffer,
             SendMessage( ( HWND ) _parnl( 1 ), EM_GETLINE, _parni( 2 ) - 1,
                          ( LONG ) Buffer ) );
}

//----------------------------------------------------------------------------//

CLIPPER MGETREPLAC() //E ( hMultiGet, cText ) --> nCode
{
   _retni( SendMessage( ( HWND ) _parnl( 1 ), EM_REPLACESEL, 0,
                        ( LPARAM ) ( ( LPSTR ) _parc( 2 ) ) ) );
}

//----------------------------------------------------------------------------//

CLIPPER GETWINTXTL() // ENGTH (hMultiGet) --> nLen
{
   _retni( GetWindowTextLength( ( HWND ) _parnl( 1 ) ) );
}

//----------------------------------------------------------------------------//
